<%@ page language="java" %>     
<%@ page import="java.util.*,org.apache.log4j.Category" %> 
<%@ page import="com.oval.util.*" %>
<%@ page import="java.io.*"%>
<%@ page import="com.oval.foundation.util.ConfigParamParseEngine" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%
FileInputStream newsfile=null;
String strnotesidparam=request.getParameter("notesid");
String aboutUs = "";
try
{
  newsfile=new FileInputStream(new File(application.getRealPath("/"),"newsfile.properties"));
  Properties prop=new Properties() ;
  prop.load(newsfile);
  int num=1;
  Vector vhpnews=new Vector();
  
  if(prop.getProperty("aboutus.title")!=null && prop.getProperty("aboutus.title").trim().length()!=0)
	  aboutUs = prop.getProperty("aboutus.title");
  if(aboutUs!=null)
	  aboutUs=new String(aboutUs.getBytes("ISO8859-1"),"UTF-8");

  while(true)
  {
    String news_notesid=prop.getProperty("news.notesid."+num);
    if(news_notesid==null ||news_notesid.trim().length()==0)
      break;
    HashMap map=new HashMap();
    map.put("notesid",news_notesid);
    String news_title=prop.getProperty("news.title."+num);
    String news_nc=prop.getProperty("news.nc."+num);
    if(news_title!=null)
      news_title=new String(news_title.getBytes("ISO8859-1"),"UTF-8");
    else
      news_title="";
    if(news_nc!=null)
      news_nc=new String(new String(news_nc.getBytes("ISO8859-1"),"UTF-8"));
    else
      news_nc="";
      
    map.put("title",news_title);
    map.put("nc",news_nc);
    vhpnews.add(map);
    if(strnotesidparam!=null && strnotesidparam.equals(news_notesid))
      pageContext.setAttribute("onenews",map);
    num++;  
  }
  pageContext.setAttribute("hpnews",vhpnews);
}
catch(Exception ex)
{
}
finally
{
  try{newsfile.close();}catch(Exception ex){}
}

%>

<% 
  String strModuleName = "UPM";
  String strFileDir = ConstantProp.DEFAULT_IMG_SRC;
%>  
<%@ include file="/inc/PageDefault.inc" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/<%= strLanguageCode %>/chinese/main.css" type="text/css">
<link rel="stylesheet" href="css/<%= strLanguageCode %>/csscontent.css" type="text/css"> 
<script language="JavaScript" src="css/<%= strLanguageCode %>/chinese/script.js"></script>
<script language="JavaScript" src="js/FuncLib.js"></script>
<script language="JavaScript">
var remote;
function view_prod(id)
{
  var viewurl = "masterdata/pcm/ItemPublicInfo.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&prodid=" + id;
  if(remote != null)
    remote.close();
  remote = window.open(viewurl,'newwindow','height=600,width=750,top=100,left=100,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
}
function popPic(id,name)
{
  var viewurl = "common/Picture.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&itemid=" + id + "&picturename=" + name;
  if(remote != null)
    remote.close();
  remote = window.open(viewurl,'newwindow','height=600, width=800,top=100,left=100,toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, status=no');
}

function view_notes(id)
{
    document.cform.notesid.value=id;
    cform.action = "Content.jsp?<%= OvalTools.randomURL() %>";
    cform.target = "_self";
    isRunning = true;
    cform.submit();

}
</script>
</head>   
  <%     
	  HashMap one_News = (HashMap)pageContext.getAttribute("onenews");
	  if(one_News == null)
	  {
	  	one_News = new HashMap();
	  }  
  
     Vector v_Aboutus = (Vector)pageContext.getAttribute("hpaboutus");
     if (v_Aboutus == null) 
     {
       v_Aboutus = new Vector();
     }
     if(v_Aboutus.size() > 0)
     {
        aboutUs = (String)(((HashMap)v_Aboutus.elementAt(0)).get("title"));
     }
  %> 
<body bgcolor="#FFFFFF" text="#000000">
 <form name="cform" method="post" action="Dispatcher">
 <input type="hidden" name="notesid">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td bgcolor="EFEFEF" height="20">&nbsp;</td>
  </tr>
  <tr> 
    <td><img src="images/<%= strLanguageCode %>/chinese/homepagebt.jpg"></td>
  </tr>
  <tr>
    <td height="10"></td>
  </tr>
  <tr> 
    <td>
      <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC">
        <tr bgcolor="#FFFFFF">
          <td bgcolor="6DA6DA" height="20" width="40%"><img src="images/<%= strLanguageCode %>/quote.gif" width="16" height="11"> 
          <%=label.getLabelName("L_SysAnnouncement") %></td>
          <td bgcolor="6DA6DA" width="60%"> <img src="images/<%= strLanguageCode %>/chinese/quote.gif" width="16" height="11"> 
            <%=label.getLabelName("L_Publication") %></td>          
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td valign="top" width="40%">
            <table cellspacing=0 cellpadding=3 width="100%" border=0>
                <%
	            Vector v_News = (Vector)pageContext.getAttribute("hpnews");
	            if(v_News == null)
	            {
	              v_News = new Vector();
	            }
	
	            int length = 10;
	            if(length > v_News.size())
	            {
	              length = v_News.size();
	            }
	            for(int i = 0; i < length; i++)
	            {
	              HashMap a_news = (HashMap)v_News.elementAt(i);
	              if(a_news != null)
	              {
			        %>
			        <tr>
			          <td class=center width=25><img height=9 src="images/chinese/Blue_arrow.gif" width=8></td>
			          <td height="25"> <a href="javascript:view_notes('<%=JspHelper.filterNull( a_news.get("notesid") )%>')"><%=JspHelper.filterNull( (String)a_news.get("title") )%></a></td>
			          <td width=85><font color=#666666><%=JspHelper.filterNull( a_news.get("datelastupdated") )%></font></td>
			        </tr>
			        <%
		           }
		        }
		        %>
            </table>
          </td>
          <td width="40%" valign="top">
          	<table width="100%" border="0" cellspacing="0" cellpadding="4">
				<tr> 
					<td valign="top" class="content-text-gray1">
					<%if(one_News.get("title")!= null){%>
						<%= (String)one_News.get("nc") %>
					<%}%>			
					</td>
				</tr>
			</table>          
          </td>
        </tr>
        <tr>
          <td bgcolor="FFD35E" colspan="2"> <img src="images/<%= strLanguageCode %>/chinese/quote.gif" width="16" height="11"> 
            <%=label.getLabelName("L_ComIntroduction") %></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td width="100%" valign="top" colspan="2 bgcolor="#FFFFFF"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF">
              <tr> 
                <td class="content-text-gray1" bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;<%=JspHelper.filterNull( aboutUs )%>&nbsp; 
                </td>
              </tr>
            </table>
          </td>        
        </tr>
      </table>
    </td>
  </tr>   
</table>
</form>
</body>
</html>
